LDDINC = ../lib_kernel

DEBUG=y

ifeq ($(DEBUG),y)
	DEBFLAGS = -O -g -DPRINT_DEBUG
else
	DEBFLAG = -O2
endif


EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)

ifneq ($(KERNELRELEASE), )

MOD	:= sample
$(MOD)-objs := main.o 

obj-m	+= $(MOD).o

else
	KERNELDIR ?= /lib/modules/$(shell uname -r)/build/
	PWD     := $(shell pwd)

modules:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../lib_kernel modules

endif

install:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
	depmod -A
clean:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean



edit:
	ctags -R ./*  $(LDDINC)
	vim -p \
		main.c hello_mod.h
